﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Newtonsoft.Json;

namespace IDotNet.MapLibs.Web.Pages
{
    public partial class SelectMapPage : BasePage, ISelectMap
    {
        protected string selectMapReqJson;
        protected void Page_Load(object sender, EventArgs e)
        {
            SelectMap();
        }
        public SelectMapReqModel GetSelectMapParam()
        {
            return GetParam<SelectMapReqModel>();
        }
        public bool CheckSelectMapParam(SelectMapReqModel request, out string errMsg)
        {
            if (request == null)
            {
                errMsg = "请求参数为空";
                return false;
            }
            if (request.ReturnUrl == null)
            {
                errMsg = "回调页面为空";
                return false;
            }

            errMsg = null;
            return true;
        }

        public SelectMapResultInfo SelectMap()
        {
            var selectMapReq = GetSelectMapParam();

            string checkErrMsg;
            if (CheckSelectMapParam(selectMapReq, out checkErrMsg))
            {
                selectMapReqJson = ToJsonString(selectMapReq);
            }
            else
            {
                ShowMsg(checkErrMsg);
            }
            return null;
        }
    }
}